home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AmigActive 24
/
AACD 24.iso
/
AACD
/
Utilities
/
Workbench2000
/
Goodies
/
Tools
/
Vapor2WB2KMimeCnvrt.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
2000-09-17
|
4KB
|
154 lines
/*
** $VER: Vapor2WB2KMimeCnvrt.rexx 0.001 (15 Sep 2000) Andreas Mixich <sp.amix@gmx.net>
**
** © 2000 Andreas Mixich
**
** PROGRAMNAME:
** Vapor2WB2KMimeCnvrt.rexx
**
** FUNCTION:
** Converts Vapor's MIMEPrefs settings to WB2000 format. Icon information
** has to be entered by hand later, in the WB2000 MIME Editor.
**
** $HISTORY:
**
** 15 Sep 2000 : 0.01 : initial release
*/
/* ///------------------- "Init,ReadArgs,Setvars,AddLibs" -------------------- */
/* enable support functions */
SIGNAL ON ERROR
SIGNAL ON FAILURE
SIGNAL ON HALT
SIGNAL ON BREAK_C
SIGNAL ON SYNTAX
OPTIONS RESULTS
/* define some usefull vars */
TRUE = 1
FALSE = 0
LF = '0A'x /* linefeed */
appname = 'Vapor2WB2KMimeCnvrt.rexx' /* program's name */
appversion = '$VER: Vapor2WB2KMimeCnvrt.rexx 0.001 (15 Sep 2000) Andreas Mixich <sp.amix@gmx.net>'
appauthor = 'Andreas Mixich <sp.amix@gmx.net>'
appcopyr = '© 2000 Andreas Mixich <sp.amix@gmx.net>'
ArgsTemplate = "FROM,TO"
argu.FROM = 'envarc:mime.prefs'
argu.TO = 'RAM:WB2000_MIME.prefs'
nsuffix = ''
/* add the needed libraries */
IF ~SHOW('LIBRARIES','rexxdossupport.library') THEN
CALL ADDLIB('rexxdossupport.library',0,-30,0)
IF ~SHOW('LIBRARIES','rexxsupport.library') THEN
CALL ADDLIB('rexxsupport.library',0,-30,0)
PARSE ARG argu
IF strip(argu) = '?' THEN
DO
Call WriteCH(STDOUT,argstemplate||' : ')
argu = ReadLN(STDIN)
END
IF ~ReadArgs(argu,ArgsTemplate,'argu.') THEN
DO
Call WriteLN(STDOUT,Fault(RC)||' '||appname)
EXIT(10)
END
/*\\\*/
/* ///-------------------------------- "Main" -------------------------------- */
IF ~Open(in,argu.FROM,R) THEN
DO
SAY "File "||argu.FROM||" not found. Exiting."
EXIT(20)
END
ELSE
DO i = 1 UNTIL EOF(in)
line.i = ReadLN(in)
PARSE VAR line.i group.i '/' type.i ',' suffix.i ',' savepath.i ',' utility.i ',' .
END
line.0 = i - 1
IF Exists(argu.TO) THEN
DO
SAY "Warning ! The file "||argu.TO||" will be overwritten !"
OPTIONS PROMPT "Proceed ? (y/N)"
PULL dummy
IF dummy ~= "Y" THEN
DO
SAY "Operation aborted. Exiting."
EXIT
END
END
CALL Open(out,argu.TO,W)
DO i = 1 TO line.0
IF Left(line.i,1) = ";" THEN ITERATE
ELSE
DO
IF (Words(suffix.i) = 1 | Words(suffix.i) = 0) THEN
DO
IF suffix.i = "SUFFIX.I" | suffix.i = '' THEN suffix.i = ''
ELSE suffix.i = '*.'||suffix.i
CALL WriteLN(out,group.i||','||type.i||','||suffix.i||','||utility.i||',')
END
ELSE
DO
nsuffix = '(*.('
DO j = 1 TO Words(suffix.i)
nsuffix = Insert(nsuffix,Word(suffix.i,j)||'|')
END
nsuffix = Strip(nsuffix,T,'|')
suffix = nsuffix||'))'
IF suffix = "SUFFIX" THEN suffix = ''
CALL WriteLN(out,group.i||','||type.i||','||suffix||','||utility.i',')
END
DROP suffix
END
END
CALL WriteLN(out,'@')
CALL Close(out)
EXIT
/*\\\*/
/* ///------------------------------- "Errors" ------------------------------- */
/* BREAK_C */
BREAK_C:
SAY appname||' : ***BREAK'
EXIT
RETURN
/* ARexx HALT */
HALT:
SAY appname||' : HALTED'
EXIT
RETURN
/* Error */
ERROR:
SYNTAX:
FAILURE:
SAY appname||' : Error at line '||SIGL||': '||SourceLine(SIGL)
SAY 'Error: '||RC||' '||ErrorText(RC)
EXIT
RETURN
/*\\\*/